<?php

/*
	插件安装文件
*/

!defined('DEBUG') AND exit('Forbidden');



$tablepre = $db->tablepre;

//创建标签数据表
$sql = "CREATE TABLE `{$tablepre}di_tag` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(128) NOT NULL ,
  `num` INT NOT NULL ,
  PRIMARY KEY (`id`),
  UNIQUE (`name`)
  ) ENGINE = InnoDB;";
$r = db_exec($sql);

//标签-帖子关联表
$sql = "CREATE TABLE `{$tablepre}di_tag_thread` (
`id` INT NOT NULL AUTO_INCREMENT ,
 `tid` INT NOT NULL ,
 `tag_name` VARCHAR(128) NOT NULL ,
 PRIMARY KEY (`id`)
  ) ENGINE = InnoDB;";
$r = db_exec($sql);


//form添加板块类型字段
$sql="ALTER TABLE ` {$tablepre}forum` ADD `cate` INT NOT NULL AFTER `seo_keywords`";
$r = db_exec($sql);


//自动分词关键词
$sql="ALTER TABLE `{$tablepre}thread` ADD `keywords` TEXT NOT NULL COMMENT '关键词' ";
$r = db_exec($sql);


//创建标签邀请码数据表
$sql = "CREATE TABLE `{$tablepre}di_codes` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `code` VARCHAR(128) NOT NULL ,
  `status` INT NOT NULL ,
  `useid` INT NOT NULL ,
  `usetime` INT NOT NULL ,
  PRIMARY KEY (`id`),
  UNIQUE (`name`)
  ) ENGINE = InnoDB;";
$r = db_exec($sql);

//添加封面图片字段
$sql='ALTER TABLE `{$tablepre}_thread` ADD `image` VARCHAR(255) NOT NULL COMMENT '封面图片地址' AFTER `lastpid`;'
$r = db_exec($sql);


?>